{layout name="main"/}
<div class="wrapper wrapper-content animated fadeInUp">

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">

                <div class="ibox-title">
                    <h5>申请提现</h5>

                </div>
                <div class="ibox-content">
                    <form method="post" action="" class="form-horizontal m-t" id="encashment">

                        <div class="form-group">
                            <label class="col-sm-3 control-label">会员编号 * </label>
                            <div class="col-sm-5">

                                <input type="text" class="form-control" value="{$user->user_uniid}" readonly="readonly">
                            </div>
                        </div>



                        <div class="form-group">
                            <label class="col-sm-3 control-label">提现金额 * </label>
                            <div class="col-sm-5">

                                <div class="input-group m-b"><span class="input-group-addon">&yen;</span>
                                    <input type="text" class="form-control" name="cash_value"> <span class="input-group-addon">.00</span>

                                </div>
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 当前可提现金额为：&yen;{$user->money_cash}元，冻结金额为：&yen;{$frozenaward}元</span>


                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <button class="btn btn-primary" type="button" onclick="add()">确认提现</button>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
    <script>
      function add()
      {
        var postdata = $("#encashment").serialize();
        post({
            url: "{$thispageurl}",
            data: postdata,
            success: function(res) {
                swal({
                    title: 'success',
                    text: res.message,
                    type: "success"
                }, function() {
                    reload();
                });
            },
            error: function(error) {
                swal("错误", JSON.parse(error.responseText).message, "error");
            }
        });
      }
    </script>
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">

                <div class="ibox-title">
                    <h5>我的提现列表</h5>

                </div>

                <div class="ibox-content">
                    <div class="row m-b-sm m-t-sm">
                        <div class="col-sm-4">
                            <div class="input-daterange input-group" id="datepicker">
                                <input type="text" class="input-sm form-control" name="startdate" placeholder="开始时间" value="{$startdate}" />
                                <span class="input-group-addon">到</span>
                                <input type="text" class="input-sm form-control" name="enddate"  placeholder="结束时间" value="{$enddate}" />
                            </div>

                        </div>
                        <div class="col-sm-1">
                          <button type="button" class="btn btn-primary" onclick="search()">搜索</button>
                        </div>
                        <div class="col-sm-7 text-right">
                            <div class="btn-group">
                                <a href="{:url('admin/Money/applyMoney')}" class="btn {if condition="$cash_flow_status==0"}btn-primary{else}btn-white{/if} btn-sm" type="button">全部</a>
                                <a href="{:url('admin/Money/applyMoney',['cash_flow_status'=>2])}" class="btn {if condition="$cash_flow_status==2"}btn-primary{else}btn-white{/if} btn-sm" type="button">已提现</a>
                                <a href="{:url('admin/Money/applyMoney',['cash_flow_status'=>1])}" class="btn {if condition="$cash_flow_status==1"}btn-primary{else}btn-white{/if} btn-sm" type="button">处理中</a>
                                <a href="{:url('admin/Money/applyMoney',['cash_flow_status'=>3])}" class="btn {if condition="$cash_flow_status==3"}btn-primary{else}btn-white{/if} btn-sm" type="button">提现失败</a>
                            </div>
                            <!--                          <div data-toggle="buttons" class="btn-group">
                                                                <label class="btn btn-sm btn-white">
                                                                    <input type="radio" id="option1" name="options">天</label>
                                                                <label class="btn btn-sm btn-white">
                                                                    <input type="radio" id="option2" name="options">周</label>
                                                                <label class="btn btn-sm btn-white active">
                                                                    <input type="radio" id="option3" name="options">月</label>
                                                            </div>-->
                            <!--
                                                        <div class="input-group">
                                                            <input type="text" placeholder="搜索()" class="input-sm form-control" name=keyword value=""> <span class="input-group-btn">
                                                                <button type="button" class="btn btn-sm btn-primary" onclick="search()">搜索</button> </span>
                                                        </div>-->
                        </div>
                    </div>
                    <div class="profile-content">
                        <table class="footable table table-stripped toggle-arrow-tiny">
                            <thead>
                                <tr>

                                    <th  style="width: 15%;">会员编号</th>

                                    <th  style="width: 10%;">提现金额</th>
                                    <th  style="width: 10%;">实发金额</th>
                                    <th  style="width: 20%;">提现时间</th>

                                    <th  style="width: 5%;">状态</th>
                                    <th data-hide="all">开户行</th>
                                    <th data-hide="all">银行卡号</th>
                                    <th data-hide="all">开户姓名</th>
                                    <th data-hide="all">开户支行</th>
                                    <th data-hide="all">操作人员</th>
                                    <th data-hide="all">操作备注</th>
                                    <th data-hide="all">处理时间</th>
                                </tr>
                            </thead>

                            <!--                            <tbody><tr class="no-records-found"><td colspan="8">没有找到匹配的记录</td></tr></tbody>-->

                            <tbody>
                              {:table_empty_list($encashmentlist,'暂无数据!',12)}
                              {volist name="encashmentlist" id="encashment"}
                                <tr>

                                    <td>
                                        <span class="footable-toggle"></span>
                                        {$encashment->target_user->user_uniid}
                                    </td>

                                    <td class="center ">{$encashment->cash_value}</td>
                                    <td class="center ">{$encashment->encashed_value}</td>
                                    <td class="center ">{$encashment->create_time}</td>

                                    <td class="center"><span class="badge {switch name="encashment.cash_flow_status"}{case value="已完成"}badge-primary{/case}{case value="正在进行"}badge-warning{/case}{case value="失败"}badge-danger{/case}{/switch}">{$encashment->cash_flow_status}</span></td>
                                    <td>{$encashment->card->bank_name}</td>
                                    <td><span class="pie">{$encashment->card->card_number}</span></td>
                                    <td>{$encashment->card->card_name}</td>
                                    <td>{$encashment->card->card_sub_bank}</td>
                                    <td>{$encashment->confirm_user->user_name}</td>
                                    <td>{$encashment->cash_flow_comments}</td>
                                    <td>{$encashment->confirm_time}</td>
                                </tr>
                                {/volist}



                            </tbody>

                        </table>
                        <!--                        <div class="row">
                                                    <div class="col-sm-6 m-t-sm">
                                                        <button class="btn btn-primary btn-xs" id="selectAll" onclick="deletearticle(1)"><i class="fa fa-check"></i> 全选 </button>
                                                        <button class="btn btn-warning btn-xs" id="deleteAll" onclick="deletearticle(1)"><i class="fa fa-trash"></i> 批量删除 </button>
                                                    </div>
                                                </div>-->
                                                <div class="row">
                                                    <div class="col-sm-6">
                                                        <div class="dataTables_info" id="DataTables_Table_0_info" role="alert" aria-live="polite" aria-relevant="all">
                                                            每页显示 {:getPageSize()} 项，共 {$encashmentlist->toArray()['total']} 项</div></div>
                                                    <div class="col-sm-6">
                                                        <div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
                                                            {$encashmentlist->render()}

                                                        </div>

                                                    </div>
                                                </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<script>
function search() {
    var url = "{:url('admin/Money/applyMoney', [],'')}";
    var startdate = $("input[name=startdate]").val();
    var enddate = $("input[name=enddate]").val();
    if(startdate!="")
    {
      url=url+"/startdate/" + startdate;
    }
    if(enddate!="")
    {
      url=url+"/enddate/" + enddate;
    }
    toUrl(url);
    }
    $(document).ready(function () {
        $(".footable").footable();
    });
    $(".input-daterange").datepicker({keyboardNavigation: !1, forceParse: !1, autoclose: !0});
</script>
